package org.anddev.andengine.extension.svg.util.primitives;

import javax.microedition.khronos.opengles.GL10;

import org.anddev.andengine.entity.primitive.Line;
import org.anddev.andengine.opengl.util.GLHelper;

public class AntiAliasLine extends Line{
	
	private boolean mAntiAlias = false;
	
	public AntiAliasLine(final float pX1,final float pY1,final float pX2,final float pY2) {
		super(pX1, pY1, pX2, pY2);
	}
	
	public AntiAliasLine(final float pX1, final float pY1, final float pX2, final float pY2, final float pLineWidth) {
		super(pX1, pY1, pX2, pY2, pLineWidth);
	}
	
	@Override
	protected void onInitDraw(final GL10 pGL) {
		super.onInitDraw(pGL);
		GLHelper.disableTextures(pGL);
		GLHelper.disableTexCoordArray(pGL);
		GLHelper.lineWidth(pGL, this.getLineWidth());
		
		if(this.mAntiAlias){
			pGL.glEnable(GL10.GL_LINE_SMOOTH);
			pGL.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
		}
	}
	
	public void setAntiAlias(boolean pAntiAlias){
		this.mAntiAlias = pAntiAlias;
	}
	
	public boolean getAntiAlias(){
		return this.mAntiAlias;
	}
}
